import json

import requests

if __name__ == "__main__":
    # ua伪装
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62"
    }
    params = {
        "type": "24",
        "interval_id": "100:90",
        "action": "",
        "start": 0,
        "limit": 20
    }
    response = requests.get("https://movie.douban.com/j/chart/top_list", params=params, headers=headers)
    json.dump(response.json(), open("./file/douban.json", "w", encoding="utf-8"), ensure_ascii=False)
    print("over!!!")
